from wtforms import Form, StringField, validators, IntegerField


class RoleAdd(Form):
    name = StringField(validators=[validators.DataRequired(message='角色名称为空')])
    code = StringField(validators=[validators.DataRequired(message='角色编码为空')])
    sort = IntegerField(validators=[validators.NumberRange(min=0, max=None, message='排序为空')])
    status = IntegerField(validators=[validators.NumberRange(min=0, max=None, message='状态为空')])


class RoleEdit(Form):
    id = StringField(validators=[validators.DataRequired(message='角色 ID 为空')])
    name = StringField(validators=[validators.DataRequired(message='角色名称为空')])
    code = StringField(validators=[validators.DataRequired(message='角色编码为空')])
    sort = IntegerField(validators=[validators.NumberRange(min=0, max=None, message='排序为空')])
    status = IntegerField(validators=[validators.NumberRange(min=0, max=None, message='状态为空')])
